<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <script type="text/javascript" src="<%=basePath%>js/initPage.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>随便打TCS系统</title>
    <!-- Bootstrap -->
    <link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
          rel="stylesheet">
    <!-- Font Awesome -->
    <link
            href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
            rel="stylesheet">
    <!-- NProgress -->
    <link href="<%=basePath%>vendors/nprogress/nprogress.css"
          rel="stylesheet">
    <!-- iCheck -->
    <link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
          rel="stylesheet">
    <!-- bootstrap-progressbar -->
    <link
            href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
            rel="stylesheet">
    <!-- JQVMap -->
    <link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
          rel="stylesheet"/>
    <!-- bootstrap-daterangepicker -->
    <link
            href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
            rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">
</head>
<%@ include file="loginCheck.jsp" %>
<body class="nav-md">
<div class="container body">
    <div class="main_container">
        <div class="col-md-3 left_col">
            <div class="left_col scroll-view">
                <div class="clearfix"></div>
                <br/>
            </div>
        </div>
        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left"></div>
                    <div class="x_content">
                        总收益<span>${rechargeProfit}</span>元
                        已提现<span>${alreadyMoney}</span>元
                        <%--<button onclick="rechangemoney()">点击提现</button>--%>
                        <button onclick="tijiaoshenqing()">提交申请</button>
                    </div>
                </div>
                <div class="x_panel">
                    <div class="x_content">
                        <table id="datatable" class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>收益编号</th>
                                <th>用户手机号</th>
                                <th>用户支付金额</th>
                                <th>用户支付时间</th>
                                <th>返佣比例</th>
                                <th>收益信息</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${refundList}" var="s" varStatus="z">
                                <tr>
                                    <td>${s.id}</td>
                                    <td>${s.userMobile }</td>
                                    <td>${s.totalpay }</td>
                                    <td><fmt:formatDate value="${s.createTime}" type="date"
                                                        pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                    <td>${s.currentprofit }</td>
                                    <td>${s.profit }</td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>

                <!-- 模态框（Modal） -->
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                     aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">×
                                </button>
                                <h4 class="modal-title" id="myModalLabel">
                                    填写提现信息
                                </h4>
                            </div>
                            <div class="modal-body">
                                <form name="myForm" class="form-horizontal form-label-left"
                                      novalidate method="post" enctype="multipart/form-data"
                                      id="myForm">
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">阿里账号名 <span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="aliaccount" class="form-control col-md-7 col-xs-12"
                                                   name="aliaccount" type="text" value="">
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">银行名 <span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="bankname" class="form-control col-md-7 col-xs-12"
                                                   name="bankname" type="text" value="">
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">银行卡号 <span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="bankno" class="form-control col-md-7 col-xs-12"
                                                   name="bankno" type="text" value="">
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">银行预留真实姓名 <span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="bankrealname" class="form-control col-md-7 col-xs-12"
                                                   name="bankrealname" type="text" value="">
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">姓名<span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="name" class="form-control col-md-7 col-xs-12"
                                                   name="name" type="text" value="">
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                               for="name">手机号<span class="required"></span>
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input id="mobile" class="form-control col-md-7 col-xs-12"
                                                   name="mobile" type="text" value="">
                                        </div>
                                    </div>

                                </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default"
                                        data-dismiss="modal">关闭
                                </button>
                                <button onclick="uploadBankNews()" type="button" class="btn btn-primary">
                                    提交更改
                                </button>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->

                <div class="clearfix"></div>
                <br/>
            </div>
            <div style="width: 100%; text-align: center;">
                <div id='page'></div>
            </div>
        </div>
    </div>
</div>
<!-- jQuery -->
<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
<script>
    /**
     * 纯粹的JS分页插件，代码缺点：JS操作DOM冗余太多，太繁琐
     */
    pageUtil.initPage('page', {
        totalCount: '${pages.recordTotal}', //总页数，一般从回调函数中获取。如果没有数据则默认为1页
        curPage: ${pages.currentPageNo}, //初始化时的默认选中页，默认第一页。如果所填范围溢出或者非数字或者数字字符串，则默认第一页
        showCount: 9, //分页栏显示的数量
        pageSizeList: [10, 100, 1000], //自定义分页数，默认[5,10,15,20,50]
        defaultPageSize: 10, //默认选中的分页数,默认选中第一个。如果未匹配到数组或者默认数组中，则也为第一个
        isJump: true, //是否包含跳转功能，默认false
        isPageNum: true, //是否显示分页下拉选择，默认false
        isPN: true, //是否显示上一页和下一面，默认true
        isFL: true, //是否显示首页和末页，默认true
        jump: function (curPage) { //跳转功能回调，传递回来2个参数，当前页和每页大小。如果没有设置分页下拉，则第二个参数永远为0。这里的this被指定为一个空对象，如果回调中需用到this请自行使用bind方法
            selectALL('${status}', curPage);
        },
    });
</script>
<script type="text/javascript">
    var orderNo = "";

    // 主页
    function selectALL(status, curPage) {
        // var orderNum = $("#orderNum").val();
        // var createtime = $("#createTime").val();
        // var regTime = /^([0-2][0-9][0-9][0-9])-([0-1][0-9])-([0-3][0-9])$/;
        // if (createtime.length != 0 && !regTime.test(createtime)) {
        //     alert('请输入正确日期格式（例如：2018-01-01）');
        //     return false;
        // }
        window.location.href = "rechargeprofit?currentPageNo=" + curPage;
    }

    /**
     * 提交用户的个人提现信息
     */
    function uploadBankNews() {
        var adminid = "${adminUserId}";
        var aliaccount=$("#aliaccount").val();
        var bankname=$("#bankname").val();
        var bankno=$("#bankno").val();
        var bankrealname=$("#bankrealname").val();
        var name=$("#name").val();
        var mobile=$("#mobile").val();
        $.ajax({
            // url: "http://47.105.121.181/SbdVoip/admin/alreadyMoney",
            url: "http://1688call.cn/SbdVoip/admin/insertBankNews",
            type: "post",
            data: {
                adminid: adminid,
                aliaccount: aliaccount,
                bankname: bankname,
                bankno: bankno,
                bankrealname: bankrealname,
                name: name,
                mobile: mobile
            },
            dataType: "text",
            success: function (jsonData) {
                    alert(jsonData);
                    //如果已经填写信息则直接提交提现申请
                    $('#myModal').modal('hide');
            }
        });
    }
    function tijiaoshenqing() {
        var adminid = "${adminUserId}";
        $.ajax({
            // url: "http://47.105.121.181/SbdVoip/admin/alreadyMoney",
            url: "http://1688call.cn/SbdVoip/admin/findBankNews",
            type: "post",
            data: {
                adminid: adminid
            },
            dataType: "json",
            success: function (jsonData) {
                if (jsonData == false) {
                    $('#myModal').modal('show')
                }else{
                    rechangemoney();
                }
            }
        });
    }

    function rechangemoney() {
        var adminid = "${adminUserId}";
        $.ajax({
            // url: "http://47.105.121.181/SbdVoip/admin/alreadyMoney",
            url: "http://1688call.cn/SbdVoip/admin/alreadyMoney",
            type: "post",
            data: {
                money: 0,
                adminid: adminid
            },
            dataType: "json",
            success: function (jsonData) {
              alert("提交成功");
            }
        });
    }

</script>
<!-- Bootstrap -->
<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
<script
        src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- Chart.js -->
<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>
<!-- Custom Theme Scripts -->
<script src="<%=basePath%>build/js/custom.min.js"></script>
<!-- layui -->
<script src="<%=basePath%>vendors/layui/layui.js"></script>

</body>
</html>